package com.qianli.cashmama.trade.client.bill.request;

import com.fqgj.common.api.ParamsObject;
import com.fqgj.common.utils.StringUtils;
import com.fqgj.exception.common.ApplicationException;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 账单试算
 * Created with IntelliJ IDEA.
 * User: pavan
 * Date: 2020/4/13
 * Time: 下午5:25
 */
public class RepaymentTrialRequest extends ParamsObject {

    /**
     * 订单号
     */
    private String tradeNo;
    /**
     * 账单号
     */
    private String billNo;
    /**
     * 试算日期(不传按当前时间计算)
     */
    private Date plannedRepaymentDate;
    /**
     * 试算-现金金额
     */
    private BigDecimal capital;
    /**
     * 试算-抵扣金额
     */
    private BigDecimal discountCapital;

    public String getTradeNo() {
        return tradeNo;
    }

    public RepaymentTrialRequest setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
        return this;
    }

    public String getBillNo() {
        return billNo;
    }

    public RepaymentTrialRequest setBillNo(String billNo) {
        this.billNo = billNo;
        return this;
    }

    public Date getPlannedRepaymentDate() {
        return plannedRepaymentDate;
    }

    public RepaymentTrialRequest setPlannedRepaymentDate(Date plannedRepaymentDate) {
        this.plannedRepaymentDate = plannedRepaymentDate;
        return this;
    }

    public BigDecimal getCapital() {
        return capital;
    }

    public RepaymentTrialRequest setCapital(BigDecimal capital) {
        this.capital = capital;
        return this;
    }

    public BigDecimal getDiscountCapital() {
        return discountCapital;
    }

    public RepaymentTrialRequest setDiscountCapital(BigDecimal discountCapital) {
        this.discountCapital = discountCapital;
        return this;
    }

    @Override
    public void validate() {
        if (StringUtils.isEmpty(tradeNo) && StringUtils.isEmpty(billNo)) {
            throw new ApplicationException("Parameter error");
        }
    }
}
